import nyNetwork from "@/api/nyBaseNetwork";

class DZModelGoods {
    /**
     * 商品ID
     */
    id = '';
    /**
     * 商品名称
     */
    name = '';
    /**
     * 列表封面
     */
    listCover = '';
    listCoverUrl = '';
    /**
     * 详情封面
     */
    infoCover = '';
    infoCoverUrl = '';
    /**
     * 商品类型：1-量表，2-咨询
     */
    type = 1;
    typeStr = '';
    /**
     * 商品对应的内容ID
     */
    typeId = '';
    /**
     * 商品原价，单位分
     */
    oldPrice = 0;
    /**
     * 商品现价，单位分
     */
    truePrice = 0;
    /**
     * 商品详情
     */
    desc = '';

    /**
     * 商品内容
     */
    content = '';
    /**
     * 购买须知
     */
    notice = '';
    /**
     * 是否是活动商品
     */
    activity = false;

    /**
     * 报告封面
     */
    reportCover = '';
    reportCoverUrl = '';
    /**
     * 排序
     */
    sort = '';
    /**
     * 置顶
     */
    top = 0;
    parse(data) {
        this.id = data.iid ?? '';
        this.name = data.sname ?? '';
        this.listCover = data.ilistCover ?? '';
        this.listCoverUrl = data.ilistCover ? nyNetwork.image(data.ilistCover) : '';
        this.infoCover = data.iinfoCover ?? '';
        this.infoCoverUrl = data.iinfoCover ? nyNetwork.image(data.iinfoCover) : '';
        this.reportCover = data.ireportCover ?? '';
        this.reportCoverUrl = data.ireportCover ? nyNetwork.image(data.ireportCover) : '';
        this.type = data.itype ?? 0;
        this.typeStr = data.itype == 1 ? '测评' : '咨询'
        this.typeId = data.itypeId ?? '';
        this.oldPrice = data.ioldPrice / 100 ?? 0;
        this.truePrice = data.itruePrice / 100 ?? 0;
        this.desc = data.sdesc ?? '';
        this.content = data.scontent ?? '';
        this.notice = data.snotice ?? '';
        this.activity = data.iactivity == 1;
        this.sort = data.iSort ?? 0;
    }

}
export default DZModelGoods;